<?php

	/**
	 * values() method for devmod. Set values from post/get into the devmods. commonly ussage for frontend_add/add
	 * 
	 * 24/12/2010 - added fix for empty $args[0] values
	 * 
	 * @author bsuter
	 * @package devmod
	 */
	class Devmod_method_values extends Devmod_methods_abstraction {
		
		protected $overwrite_config = true;
		
		/*
		 * because of an issue of empty values but finding the post data in the log
		 * i have added the check for empty values. let's see what happens
		 * 
		 */
		public function set_config($args)
		{
			if(count($args[0]) == 0)
			{
				new Yomm_Error('the $args[0] parameter array is empty; $args = ' . print_r($args, true)); exit;	
			}
			
			$update_array = array();
			
			foreach($this->config[$this->type]['fields'] as $field => $newname)
			{
				$update_array[$field] = $args[0]->$field;
			}
			
			$this->update_config('sql_fields', $update_array);
		}
		
	}